package com.qjc.demo.decorator.controller;

import com.qjc.demo.decorator.service.DecoratorPerson;
import com.qjc.demo.decorator.service.impl.FlyDecoratorPerson;
import com.qjc.demo.decorator.service.impl.PersonOneServiceImpl;
import com.qjc.demo.decorator.service.impl.PersonTwoServiceImpl;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName: TestDecoratorController
 * @Description:
 * @Author: qjc
 * @Date: 2021/8/24 5:41 下午
 */
@RestController
@RequestMapping("/decorator")
public class TestDecoratorController {

    @RequestMapping("/test")
    public String testStaticProxy() {
        DecoratorPerson firstDecoratorPerson = new FlyDecoratorPerson(new PersonOneServiceImpl());
        DecoratorPerson secondDecoratorPerson = new FlyDecoratorPerson(new PersonTwoServiceImpl());
        String first = firstDecoratorPerson.work();
        String second = secondDecoratorPerson.work();

        return first + "；" + second;
    }

}
